package com.axonactive.dao;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import com.axonactive.entities.Book;

@Stateless
public class BookDAO {
	@PersistenceContext 
	EntityManager em;
	
	public List<Book> getBooks(){
		return em.createQuery("Select b from Book b",Book.class).getResultList();
	}
	
	public void saveBook(Book book){
		em.persist(book);
	}
}
